﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using RATSharp.Model;

namespace RATSharpW7.Converters
{
    /// <summary>
    /// Converter for period return state
    /// </summary>
    public class PeriodReturnWorkflowConverter : IValueConverter
    {

        /// <summary>
        /// Returns localized string which corresponds to periods return workflow state
        /// </summary>
        /// <param name="value"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <param name="culture"></param>
        /// <returns></returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || !(value is ReturnAction)) return "";

            ReturnAction val = (ReturnAction)value;
            if (val == ReturnAction.NOT_RETURNABLE) return "";

            return val  == ReturnAction.RETURNED ? Application.Current.Resources["ReturnedPeriodLabel"] as string : 
                Application.Current.Resources["NotReturnedPeriodLabel"] as string;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
